home *** CD-ROM | disk | FTP | other *** search
/ Champak 141 / (Vol 141) Oct 17 2011.iso / Games / despereaux-swings.swf / scripts / swings / LoaderScript.as < prev    next >
Encoding:
Text File  |  2011-10-17  |  1.0 KB  |  40 lines

  1. package swings
  2. {
  3.    import flash.display.MovieClip;
  4.    import flash.events.Event;
  5.    import flash.text.TextField;
  6.    
  7.    public class LoaderScript extends MovieClip
  8.    {
  9.        
  10.       
  11.       public var grad:MovieClip;
  12.       
  13.       public var loadPercent:TextField;
  14.       
  15.       public function LoaderScript()
  16.       {
  17.          super();
  18.          addEventListener(Event.ENTER_FRAME,checkLoad);
  19.       }
  20.       
  21.       private function checkLoad(param1:Event) : *
  22.       {
  23.          var _loc2_:* = undefined;
  24.          _loc2_ = SwingsGame(parent).framesLoaded / SwingsGame(parent).totalFrames * 100;
  25.          loadPercent.text = int(_loc2_) + "%";
  26.          grad.scaleY = 1 - SwingsGame(parent).framesLoaded / SwingsGame(parent).totalFrames;
  27.          if(SwingsGame(parent).framesLoaded >= SwingsGame(parent).totalFrames)
  28.          {
  29.             removeEventListener(Event.ENTER_FRAME,checkLoad);
  30.             loadNext();
  31.          }
  32.       }
  33.       
  34.       private function loadNext() : *
  35.       {
  36.          SwingsGame(parent).fade("title");
  37.       }
  38.    }
  39. }
  40.